#include "Position.h"

Position::Position()
{
    x = 0, y = 0;
}
Position::Position(double xcoor, double ycoor)
{
    x = xcoor, y = ycoor;
}

Position operator+(const Position& obj1, const Position& obj2)
{
    double out_x = obj1.x + obj2.x;
    double out_y = obj1.y + obj2.y;
    return Position(out_x, out_y);
}
Position operator-(const Position& obj1, const Position& obj2)
{
    double out_x = obj1.x - obj2.x;
    double out_y = obj1.y - obj2.y;
    return Position(out_x, out_y);
}
Position Position::operator=(const Position& obj)
{
    this->x = obj.x;
    this->y = obj.y;
    return *this;
}
Position Position::operator+=(const Position& obj)
{
    this->x += obj.x;
    this->y += obj.y;
    return Position(*this);
}
Position Position::operator-=(const Position& obj)
{
    this->x -= obj.x;
    this->y -= obj.y;
    return Position(*this);
}
Position Position::operator*(const double& num) const
{
    Position temp(x * num, y * num);
    return Position(temp);
}
bool operator==(const Position& obj1, const Position& obj2)
{
    if ((obj1.x == obj2.x) && (obj1.y == obj2.y))
        return 1;
    else return 0;
}
bool operator!=(const Position& obj1, const Position& obj2)
{
    if ((obj1.x == obj2.x) && (obj1.y == obj2.y))
        return 0;
    else return 1;
}

std::ostream& operator<<(std::ostream& output, Position obj)
{
    output << "(" << obj.x << "," << obj.y << ")";
    return output;
}

void Position::setPos(double xcoor, double ycoor)
{
    x = xcoor; y = ycoor;
}

Position::~Position() {}
